mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-01 01:09:03 +03:00
4220c644cf
* support for system command via node backend. * Add env var set/unset * fix env unset function * Update libs/base/System.idr * modify system test to cover node and chez. * Add base tests for env get/set
23 lines
567 B
JavaScript
23 lines
567 B
JavaScript
const support_system_child_process = require('child_process')
|
|
|
|
function support_system_spawnSync(cmd) {
|
|
const options = { shell: true, stdio: 'inherit' }
|
|
const { status } = support_system_child_process.spawnSync(cmd, [], options)
|
|
return status
|
|
}
|
|
|
|
// call with overwrite == 0 to avoid overwriting an existing variable.
|
|
function support_system_setEnv(name, value, overwrite) {
|
|
if (overwrite == 0 && process.env[name]) {
|
|
return 0
|
|
}
|
|
process.env[name] = value
|
|
return 0
|
|
}
|
|
|
|
function support_system_unsetEnv(name) {
|
|
delete process.env[name]
|
|
return 0
|
|
}
|
|
|