SvelteNova/src/utils.ts
2021-03-02 12:23:03 +08:00

16 lines
484 B
TypeScript

// https://github.com/apexskier/nova-json-language-server/blob/a64f704bee06071ad6fd82062a3656669d62b0a8/src/main.ts#L18-L32
export async function makeFileExecutable(file: string) {
return new Promise<void>((resolve, reject) => {
const process = new Process('/usr/bin/env', {
args: ['chmod', 'u+x', file],
})
process.onDidExit((status) => {
if (status === 0) {
resolve()
} else {
reject(status)
}
})
process.start()
})
}