Skip to content

Commit

Permalink
daemon: fixup exec usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Jan 9, 2024
1 parent 5f93ae3 commit 108c128
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7988,7 +7988,7 @@ function getUserConfigDirs() {
async function isTrustedUser() {
try {
let user = os.userInfo().username;
let userGroups = await exec.exec('id', ['-Gn', user]).toString().split(' ');
let userGroups = await execToVariable('id', ['-Gn', user]).then((str) => str.trim().split(' '));
let [trustedUsers, trustedGroups] = await fetchTrustedUsers().then(partitionUsersAndGroups);
// Chech if Nix is installed in single-user mode.
let isStoreWritable = isWritable('/nix/store');
Expand All @@ -8012,7 +8012,7 @@ async function isWritable(path) {
}
async function fetchTrustedUsers() {
try {
let conf = await exec.exec('nix show-config').toString();
let conf = await execToVariable('nix', ['show-config']);
let match = conf.match(/trusted-users = (.+);/);
return match?.length === 2 ? match[1].split(' ') : [];
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function getUserConfigDirs(): string[] {
async function isTrustedUser(): Promise<boolean> {
try {
let user = os.userInfo().username;
let userGroups = await exec.exec('id', ['-Gn', user]).toString().split(' ');
let userGroups = await execToVariable('id', ['-Gn', user]).then((str) => str.trim().split(' '));

let [trustedUsers, trustedGroups] = await fetchTrustedUsers().then(partitionUsersAndGroups);

Expand All @@ -333,7 +333,7 @@ async function isWritable(path: string): Promise<boolean> {

async function fetchTrustedUsers(): Promise<string[]> {
try {
let conf = await exec.exec('nix show-config').toString();
let conf = await execToVariable('nix', ['show-config']);
let match = conf.match(/trusted-users = (.+);/)
return match?.length === 2 ? match[1].split(' ') : [];
} catch (error) {
Expand Down

0 comments on commit 108c128

Please sign in to comment.