Skip to content

Internal double quotes in run() command arguments are removed in Windows #12

Description

@luciorq

The handling of internal quotes passed to run() arguments looks different on Windows and Linux/Unix, needs to investigate more.

Currently it was found because it breaks one test defined in: Env Var test

library(condathis)
create_env(packages = c("r-base=4.1.3"), env_name = "condathis-test-env", verbose = "full")

The following Execution behaves normally on Windows:

Important

This Example works on Windows

  withr::with_envvar(
    new = list(`MY_VAR_1` = "HELLO FROM OUTSIDE"),
    code = {
      px_res <- run(
        "R", "-q", "-s", "-e", "print(Sys.getenv('MY_VAR_1'))",
        env_name = "condathis-test-env",
        verbose = "full"
      )
    }
  )

But replacing the internal quotes of "print(Sys.getenv('MY_VAR_1'))" for 'print(Sys.getenv("MY_VAR_1"))', breaks on windows.

Caution

The following example DOES NOT work on windows

  withr::with_envvar(
    new = list(`MY_VAR_1` = "HELLO FROM OUTSIDE"),
    code = {
      px_res <- run(
        "R", "-q", "-s", "-e", 'print(Sys.getenv("MY_VAR_1"))',
        env_name = "condathis-test-env",
        verbose = "full"
      )
    }
  )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    WindowsbugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions