Sublime Forum

Multi-platform Build System - Unintuitive command priority

#1

Given a Build System like this:

{
  "selector": "source.foo",

  "shell_cmd": "verb -ixn $file | bar >x.txt",
  "windows": {
    "cmd": ["verb", "option", "$file"]
  },
}

Which of the two commands would you expect to be run in Windows? The latter, I think.

But Sublime will run the former. To work around this, the Windows override must be made a "shell_cmd" too.

This is a bug, right? Sometimes there are reasons to not want to go through the godawful cmd.exe shell.

0 Likes

#2

I wouldn’t say it’s a bug, if a shell_cmd is defined, it always takes priority over a cmd, and the shell_cmd isn’t overridden by your windows platform. It’s not designed to be mixed and matched, I’m pretty sure cmd is depreciated, no? You could define shell_cmd as null maybe if you insist on using cmd.

0 Likes

#3

If one mechanism was going to be deprecated, it should be the other way round, because shell_cmds could be expressed in terms of cmds, but not the reverse.

cmd is like fork, exec syscalling. It’s fundamental and a great thing!

[quote=“kingkeith, post:2, topic:34104”]
You could define shell_cmd as null
[/quote]Good idea

0 Likes

#4

cmd in combination with "shell": true is deprecated, but you should use cmd if you don’t need shell_cmd, because of security considerations https://docs.python.org/3/library/subprocess.html#security-considerations .

2 Likes

#5

that makes sense, thanks for educating me :slight_smile:

1 Like