Hello! So I’ve been working to make my workflow better with atom. As such I started using atom-shell-commands and wrote two commands that compile and run c++ code, respectively. Then I looked to making a command in my init.coffee that would save my current editor, execute my compile command, then execute my execute command.
atom.commands.add 'atom-text-editor', 'custom:compile-and-run', -> editor = atom.workspace.getActiveTextEditor() editor.save() atom.commands.dispatch(this, 'atom-shell-commands:Compile-build') atom.commands.dispatch(this, 'atom-shell-commands:Execute-build')
All fun, however when I execute this compile-and-run command, I get an executable that hasn’t been updated yet. So I was under the impression that either the editor does not save before the compile is executed, or the compile isn’t finished before the execute is called. So I decided to have the program sleep and print between each command. This led to a strange behavior.
As you can see from the footage, the file isn’t actually saved even after the log that happens after it. It gets saved only at the end of the command. Do commands not execute sequentially? I’m really confused as to this.