With 'Save As', the new file is not executable


#1

If you use ‘Save As…’, the new file is not executable, and I have to do a change mode every time. Is there a way to make the file executable automatically (or copy the mode from the original file)?


#2

What operating system are you asking about?


#3

macOS 10.13


#4

You should consider using init.coffee:

{BufferedProcess} = require('atom')

atom.workspace.observeTextEditors (editor) ->
  editor.onDidSave (evt) ->
    process = new BufferedProcess('chmod', ['777', evt.path], (output) => console.log(output))

#5

That doesn’t work, I get this error:

The new file is created, but the mode is still not executable.

42


#6

I copied your command and put it in init.coffee, except I changed the mode from ‘777’ to ‘700’.


#7

Hmm. Try ['700 ' + evt.path]. All args requires is an array of strings, so I’m not sure what’s bad about what I’ve written.