Skip to content

Commit 0c9352a

Browse files
committed
Bump version to 0.4.4
1 parent ffa9ef7 commit 0c9352a

File tree

5 files changed

+116
-86
lines changed

5 files changed

+116
-86
lines changed

gren.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Cabal-version: 3.8
22

33
Name: gren
4-
Version: 0.4.3
4+
Version: 0.4.4
55

66
Synopsis:
77
The `gren` command line interface.

index.js

Lines changed: 111 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,7 +3501,7 @@ var $gren_lang$node$FileSystem$Path$prepend = F2(function(left, right) {
35013501
var $gren_lang$node$FileSystem$Path$append = F2(function(left, right) {
35023502
return A2($gren_lang$node$FileSystem$Path$prepend, right, left);
35033503
});
3504-
var $author$project$Main$compilerVersion = '0.4.3';
3504+
var $author$project$Main$compilerVersion = '0.4.4';
35053505
var $gren_lang$core$Maybe$map = F2(function(f, maybe) {
35063506
if (maybe.$ === 'Just') {
35073507
var value = maybe.a;
@@ -3929,9 +3929,6 @@ var $gren_lang$core$Json$Decode$succeed = _Json_succeed;
39293929
var $author$project$Main$CompilerDownloaded = function (a) {
39303930
return { $: 'CompilerDownloaded', a: a };
39313931
};
3932-
var $author$project$Main$CompilerExecuted = function (a) {
3933-
return { $: 'CompilerExecuted', a: a };
3934-
};
39353932
var $author$project$Main$CompilerInstalled = function (a) {
39363933
return { $: 'CompilerInstalled', a: a };
39373934
};
@@ -4459,9 +4456,6 @@ var $gren_lang$node$HttpClient$errorToString = function(err) {
44594456
return _Utils_ap('Unknown error: ', debugStr);
44604457
}
44614458
};
4462-
var $gren_lang$node$Node$exitWithCode = function(code) {
4463-
return _Node_exitWithCode(code);
4464-
};
44654459
var $gren_lang$node$FileSystem$makeDirectory = F3(function(_v0, options, path) {
44664460
return A2(_FileSystem_makeDirectory, options, path);
44674461
});
@@ -4514,8 +4508,12 @@ var $gren_lang$node$ChildProcess$MergeWithEnvironmentVariables = function (a) {
45144508
var $gren_lang$node$ChildProcess$DefaultShell = { $: 'DefaultShell' };
45154509
var $gren_lang$node$ChildProcess$InheritEnvironmentVariables = { $: 'InheritEnvironmentVariables' };
45164510
var $gren_lang$node$ChildProcess$InheritWorkingDirectory = { $: 'InheritWorkingDirectory' };
4511+
var $gren_lang$node$ChildProcess$Integrated = { $: 'Integrated' };
45174512
var $gren_lang$node$ChildProcess$NoLimit = { $: 'NoLimit' };
4518-
var $gren_lang$node$ChildProcess$defaultRunOptions = { environmentVariables: $gren_lang$node$ChildProcess$InheritEnvironmentVariables, maximumBytesWrittenToStreams: 1024 * 1024, runDuration: $gren_lang$node$ChildProcess$NoLimit, shell: $gren_lang$node$ChildProcess$DefaultShell, workingDirectory: $gren_lang$node$ChildProcess$InheritWorkingDirectory };
4513+
var $gren_lang$node$ChildProcess$defaultSpawnOptions = { connection: $gren_lang$node$ChildProcess$Integrated, environmentVariables: $gren_lang$node$ChildProcess$InheritEnvironmentVariables, runDuration: $gren_lang$node$ChildProcess$NoLimit, shell: $gren_lang$node$ChildProcess$DefaultShell, workingDirectory: $gren_lang$node$ChildProcess$InheritWorkingDirectory };
4514+
var $gren_lang$core$Dict$singleton = F2(function(key, value) {
4515+
return A5($gren_lang$core$Dict$RBNode_gren_builtin, $gren_lang$core$Dict$Black, key, value, $gren_lang$core$Dict$RBEmpty_gren_builtin, $gren_lang$core$Dict$RBEmpty_gren_builtin);
4516+
});
45194517

45204518

45214519
var bufferNs = require("node:buffer");
@@ -4533,21 +4531,12 @@ var _ChildProcess_run = function (options) {
45334531
options._arguments,
45344532
{
45354533
encoding: "buffer",
4536-
cwd: workingDir.inherit ? process.cwd() : workingDir.override,
4537-
env:
4538-
env.option === 0
4539-
? process.env
4540-
: env.option === 1
4541-
? _Utils_update(process.env, _ChildProcess_dictToObj(env.value))
4542-
: _ChildProcess_dictToObj(env.value),
4534+
timeout: options.runDuration,
4535+
cwd: _ChildProcess_handleCwd(workingDir),
4536+
env: _ChildProcess_handleEnv(env),
45434537
timeout: options.runDuration,
45444538
maxBuffer: options.maximumBytesWrittenToStreams,
4545-
shell:
4546-
shell.choice === 0
4547-
? false
4548-
: shell.choice === 1
4549-
? true
4550-
: shell.value,
4539+
shell: _ChildProcess_handleShell(shell),
45514540
},
45524541
function (err, stdout, stderr) {
45534542
if (err == null) {
@@ -4588,6 +4577,51 @@ var _ChildProcess_run = function (options) {
45884577
});
45894578
};
45904579

4580+
var _ChildProcess_spawn = function (options) {
4581+
return _Scheduler_binding(function (callback) {
4582+
var workingDir = options.workingDirectory;
4583+
var env = options.environmentVariables;
4584+
var shell = options.shell;
4585+
4586+
var subproc = childProcess.spawn(options.program, options._arguments, {
4587+
cwd: _ChildProcess_handleCwd(workingDir),
4588+
env: _ChildProcess_handleEnv(env),
4589+
timeout: options.runDuration,
4590+
shell: _ChildProcess_handleShell(shell),
4591+
stdio: options.connection === 0 ? "inherit" : "ignore",
4592+
detached: options.connection === 2 && process.platform === "win32",
4593+
});
4594+
4595+
if (options.connection === 2) {
4596+
subproc.unref();
4597+
}
4598+
4599+
return function () {
4600+
subproc.kill();
4601+
};
4602+
});
4603+
};
4604+
4605+
function _ChildProcess_handleCwd(cwd) {
4606+
return cwd.inherit ? process.cwd() : cwd.override;
4607+
}
4608+
4609+
function _ChildProcess_handleEnv(env) {
4610+
return env.option === 0
4611+
? process.env
4612+
: env.option === 1
4613+
? _Utils_update(process.env, _ChildProcess_dictToObj(env.value))
4614+
: _ChildProcess_dictToObj(env.value);
4615+
}
4616+
4617+
function _ChildProcess_handleShell(shell) {
4618+
return shell.choice === 0
4619+
? false
4620+
: shell.choice === 1
4621+
? true
4622+
: shell.value;
4623+
}
4624+
45914625
function _ChildProcess_dictToObj(dict) {
45924626
return A3(
45934627
$gren_lang$core$Dict$foldl,
@@ -4603,54 +4637,62 @@ var $gren_lang$core$Basics$gt = _Utils_gt;
46034637
var $gren_lang$core$Basics$max = F2(function(x, y) {
46044638
return (_Utils_cmp(x, y) > 0) ? x : y;
46054639
});
4606-
var $gren_lang$node$ChildProcess$run = F4(function(_v0, program, _arguments, opts) {
4607-
return _ChildProcess_run({ _arguments: _arguments, environmentVariables: function () {
4608-
var _v1 = opts.environmentVariables;
4609-
switch (_v1.$) {
4610-
case 'InheritEnvironmentVariables':
4611-
return { option: 0, value: $gren_lang$core$Dict$empty };
4612-
case 'MergeWithEnvironmentVariables':
4613-
var value = _v1.a;
4614-
return { option: 1, value: value };
4615-
default:
4616-
var value = _v1.a;
4617-
return { option: 2, value: value };
4618-
}
4619-
}(), maximumBytesWrittenToStreams: opts.maximumBytesWrittenToStreams, program: program, runDuration: function () {
4620-
var _v2 = opts.runDuration;
4621-
if (_v2.$ === 'NoLimit') {
4622-
return 0;
4623-
} else {
4624-
var ms = _v2.a;
4625-
return A2($gren_lang$core$Basics$max, 0, ms);
4626-
}
4627-
}(), shell: function () {
4628-
var _v3 = opts.shell;
4629-
switch (_v3.$) {
4630-
case 'NoShell':
4631-
return { choice: 0, value: '' };
4632-
case 'DefaultShell':
4633-
return { choice: 1, value: '' };
4634-
default:
4635-
var value = _v3.a;
4636-
return { choice: 2, value: value };
4637-
}
4638-
}(), workingDirectory: function () {
4639-
var _v4 = opts.workingDirectory;
4640-
if (_v4.$ === 'InheritWorkingDirectory') {
4641-
return { inherit: true, override: '' };
4642-
} else {
4643-
var value = _v4.a;
4644-
return { inherit: false, override: value };
4645-
}
4646-
}() });
4647-
});
4648-
var $gren_lang$core$Dict$singleton = F2(function(key, value) {
4649-
return A5($gren_lang$core$Dict$RBNode_gren_builtin, $gren_lang$core$Dict$Black, key, value, $gren_lang$core$Dict$RBEmpty_gren_builtin, $gren_lang$core$Dict$RBEmpty_gren_builtin);
4640+
var $gren_lang$core$Process$spawn = _Scheduler_spawn;
4641+
var $gren_lang$node$ChildProcess$spawn = F4(function(_v0, program, _arguments, opts) {
4642+
return $gren_lang$core$Process$spawn(_ChildProcess_spawn({ _arguments: _arguments, connection: function () {
4643+
var _v1 = opts.connection;
4644+
switch (_v1.$) {
4645+
case 'Integrated':
4646+
return 0;
4647+
case 'Ignored':
4648+
return 1;
4649+
default:
4650+
return 2;
4651+
}
4652+
}(), environmentVariables: function () {
4653+
var _v2 = opts.environmentVariables;
4654+
switch (_v2.$) {
4655+
case 'InheritEnvironmentVariables':
4656+
return { option: 0, value: $gren_lang$core$Dict$empty };
4657+
case 'MergeWithEnvironmentVariables':
4658+
var value = _v2.a;
4659+
return { option: 1, value: value };
4660+
default:
4661+
var value = _v2.a;
4662+
return { option: 2, value: value };
4663+
}
4664+
}(), program: program, runDuration: function () {
4665+
var _v3 = opts.runDuration;
4666+
if (_v3.$ === 'NoLimit') {
4667+
return 0;
4668+
} else {
4669+
var ms = _v3.a;
4670+
return A2($gren_lang$core$Basics$max, 0, ms);
4671+
}
4672+
}(), shell: function () {
4673+
var _v4 = opts.shell;
4674+
switch (_v4.$) {
4675+
case 'NoShell':
4676+
return { choice: 0, value: '' };
4677+
case 'DefaultShell':
4678+
return { choice: 1, value: '' };
4679+
default:
4680+
var value = _v4.a;
4681+
return { choice: 2, value: value };
4682+
}
4683+
}(), workingDirectory: function () {
4684+
var _v5 = opts.workingDirectory;
4685+
if (_v5.$ === 'InheritWorkingDirectory') {
4686+
return { inherit: true, override: '' };
4687+
} else {
4688+
var value = _v5.a;
4689+
return { inherit: false, override: value };
4690+
}
4691+
}() }));
46504692
});
46514693
var $author$project$Main$runCompiler = function(model) {
46524694
var colorEnvVar = model.useColor ? A2($gren_lang$core$Dict$singleton, 'FORCE_COLOR', '1') : A2($gren_lang$core$Dict$singleton, 'NO_COLOR', '1');
4653-
return A4($gren_lang$node$ChildProcess$run, model.cpPermission, model.pathToString(model.localPath), model.args, _Utils_update($gren_lang$node$ChildProcess$defaultRunOptions, { environmentVariables: $gren_lang$node$ChildProcess$MergeWithEnvironmentVariables(colorEnvVar), maximumBytesWrittenToStreams: 1024 * 1024 }));
4695+
return A4($gren_lang$node$ChildProcess$spawn, model.cpPermission, model.pathToString(model.localPath), model.args, _Utils_update($gren_lang$node$ChildProcess$defaultSpawnOptions, { environmentVariables: $gren_lang$node$ChildProcess$MergeWithEnvironmentVariables(colorEnvVar) }));
46544696
};
46554697
var $gren_lang$node$FileSystem$writeFile = F3(function(_v0, bytes, path) {
46564698
return A2(_FileSystem_writeFile, bytes, path);
@@ -4671,7 +4713,7 @@ var $author$project$Main$update = F2(function(msg, model) {
46714713
}
46724714
}(), model: model };
46734715
} else {
4674-
return { command: A2($gren_lang$core$Task$attempt, $author$project$Main$CompilerExecuted, $author$project$Main$runCompiler(model)), model: model };
4716+
return { command: $gren_lang$core$Task$execute($author$project$Main$runCompiler(model)), model: model };
46754717
}
46764718
case 'CompilerDownloaded':
46774719
if (msg.a.$ === 'Err') {
@@ -4702,24 +4744,12 @@ var $author$project$Main$update = F2(function(msg, model) {
47024744
return A3($gren_lang$node$FileSystem$writeFile, model.fsPermission, res.data, model.localPath);
47034745
}, A3($gren_lang$node$FileSystem$makeDirectory, model.fsPermission, { recursive: true }, cacheFolder))))), model: model };
47044746
}
4705-
case 'CompilerInstalled':
4747+
default:
47064748
if (msg.a.$ === 'Err') {
47074749
var fsErr = msg.a.a;
47084750
return { command: $gren_lang$core$Task$execute(A2($gren_lang$node$Stream$sendLine, model.stderr, _Utils_ap('Failed to install binary after download, due to error: ', $gren_lang$node$FileSystem$errorToString(fsErr)))), model: model };
47094751
} else {
4710-
return { command: A2($gren_lang$core$Task$attempt, $author$project$Main$CompilerExecuted, $author$project$Main$runCompiler(model)), model: model };
4711-
}
4712-
default:
4713-
if (msg.a.$ === 'Err') {
4714-
var output = msg.a.a;
4715-
return { command: $gren_lang$core$Task$execute(A2($gren_lang$core$Task$andThen, function(_v6) {
4716-
return $gren_lang$node$Node$exitWithCode(output.exitCode);
4717-
}, A2($gren_lang$node$Stream$send, model.stderr, output.stderr))), model: model };
4718-
} else {
4719-
var output = msg.a.a;
4720-
return { command: $gren_lang$core$Task$execute(A2($gren_lang$core$Task$andThen, function(_v7) {
4721-
return A2($gren_lang$node$Stream$send, model.stderr, output.stderr);
4722-
}, A2($gren_lang$node$Stream$send, model.stdout, output.stdout))), model: model };
4752+
return { command: $gren_lang$core$Task$execute($author$project$Main$runCompiler(model)), model: model };
47234753
}
47244754
}
47254755
});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gren-lang",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "Compiler for the Gren programming language",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1"

src/Main.gren

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type alias Model =
3939

4040
compilerVersion : String
4141
compilerVersion =
42-
"0.4.3"
42+
"0.4.4"
4343

4444

4545
init : Node.Environment -> Init.Task { model : Model, command : Cmd Msg }

0 commit comments

Comments
 (0)