Skip to content

Commit df77f66

Browse files
authored
Merge pull request #146 from architecture-building-systems/fix-installing-from-git
Fix installing from git
2 parents 6627024 + fe797e2 commit df77f66

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

electron/cea/env.mjs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ const paths = {
3232

3333
export const getMicromambaPath = (check = false) => {
3434
const _path = paths?.[process.platform]?.['micromamba'];
35-
console.debug({ micromambaPath: _path });
3635

37-
if (_path == null || !existsSync(_path))
36+
if (_path == null || !existsSync(_path)) {
37+
console.debug({ micromambaPath: _path });
3838
throw new MicromambaError('Unable to find path to micromamba.');
39+
}
3940

4041
// Try running micromamba
4142
if (check) {
@@ -52,10 +53,11 @@ export const getMicromambaPath = (check = false) => {
5253

5354
export const getCEARootPath = () => {
5455
const _path = paths?.[process.platform]?.['root'];
55-
console.debug({ ceaPath: _path });
5656

57-
if (_path == null)
57+
if (_path == null) {
58+
console.debug({ ceaPath: _path });
5859
throw new CEAError('Unable to determine path to CEA environment.');
60+
}
5961

6062
return _path;
6163
};
@@ -80,7 +82,7 @@ export const getCEAenvVersion = async () => {
8082
export const checkCEAenv = async () => {
8183
try {
8284
await execAsync(
83-
`"${getMicromambaPath(true)}" -r "${getCEARootPath()}" -n cea run cea --help`,
85+
`"${getMicromambaPath(true)}" -r "${getCEARootPath()}" -n cea run cea --version`,
8486
);
8587
} catch (error) {
8688
console.error(error);
@@ -113,20 +115,16 @@ const installCEA = async (ceaVersion) => {
113115
// Install CEA to CEA env
114116
try {
115117
await new Promise((resolve, reject) => {
116-
const child = spawn(
117-
`"${getMicromambaPath()}"`,
118-
[
119-
'-r',
120-
getCEARootPath(),
121-
'-n',
122-
'cea',
123-
'run',
124-
'pip',
125-
'install',
126-
`git+${ceaGitUrl}`,
127-
],
128-
{ shell: true },
129-
);
118+
const child = spawn(getMicromambaPath(), [
119+
'-r',
120+
getCEARootPath(),
121+
'-n',
122+
'cea',
123+
'run',
124+
'pip',
125+
'install',
126+
`git+${ceaGitUrl}`,
127+
]);
130128

131129
child.stdout.on('data', (data) => {
132130
console.debug(data.toString().trim());

0 commit comments

Comments
 (0)