Skip to content

shell.system() can't find system commands, giving error codes 1 and 127 #56

Description

@davidm-ro

macOS 15.5. A standard Unix system command, nohup, is present:

$ nohup
usage: nohup [--] utility [arguments]

So definitely there.

However when I try to run it using shell.system(), I get errors. This includes using which to find it.

Script:

log("Testing nohup command availability...");
try {
    var result = shell.system("nohup echo 'test' > ./_train-test.txt", ".");
    log("Result: " + result);
    log("Expected: Should create file successfully");
} catch (e) {
    log("Error: " + e);
    log("Note: nohup should be available in standard Unix PATH");
}

log("Testing which nohup...");
try {
    var result = shell.system("which nohup", ".");
    log("Result: " + result);
    log("Expected: Should show path to nohup");
} catch (e) {
    log("Error: " + e);
}

log("Testing direct path to nohup...");
try {
    var result = shell.system("/usr/bin/nohup echo 'test'", ".");
    log("Result: " + result);
    log("Expected: Should work with full path");
} catch (e) {
    log("Error: " + e);
}

Expected vs Observed

  1. Should create the file in the same folder, _train-test.txt, with 'test' inside it. Instead, there is no file and I get Failed with error code: 127.
  2. Should print where nohup is found, ie for me, /usr/bin/nohup. Instead, I get Failed with error code: 1.
  3. It should write something to console; instead, I get Failed with error code: 127

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions