Atom suppressing `cmd.exe`


The following works as you’d expect, if you want to launch an application.

cmd.exe mysteriously does not. :ghost:

{ BufferedProcess } = require 'atom'

command = "notepad"
# command = "cmd"
new BufferedProcess({ command })

I assume Atom eats it up assuming you plan to interact with its internal console. But I don’t want that.

Does a workaround exist?


Doesn’t the buffered process already open a cmd.exe process to execute whatever command you give it? Why do you want to open a cmd from another cmd?


Hey, I have no idea. I should have been a little more clear with my intentions: I want to strike a hotkey and have my code do its thing in a command prompt.

It’s not that I want to run cmd.exe per se, but I want my results in that window just the same.

As it stands there is no such window. Nada.


Hallelujah! I made it work.

{ BufferedProcess } = require 'atom'

command = "start"
args = ["cmd"]

new BufferedProcess({ command, args })

In a more useful context:

Run = (cmd) -> # execute `cmd` with argument `file_path`
    atom_path = atom.config.getUserConfigPath().replace("config.cson", "")
    file_path = editor.getPath()

    # make process
    { BufferedProcess } = require 'atom'

    command = "start"
    args = ["", "cmd", "/c", cmd, file_path]
    options =
        cwd: "#{ atom_path }/user_scripts"

    new BufferedProcess({ command, args, options })