Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

import { Command } from "commander";
import { createShellConfigs, initSupportedShells as shells, getShellSourceCommand, Shell } from "../utils/shell.js";
import { unpackNativeModules, unpackShellFiles } from "../utils/node.js";
import { permissionNativeModules, unpackNativeModules, unpackShellFiles } from "../utils/node.js";
import { render } from "../ui/ui-init.js";

const supportedShells = shells.join(", ");

const action = (program: Command) => async (shell: string | undefined) => {
await createShellConfigs();
await unpackNativeModules();
await permissionNativeModules();
await unpackShellFiles();

if (shell == null) {
Expand Down
3 changes: 2 additions & 1 deletion src/ui/ui-reinit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import chalk from "chalk";
import { unpackNativeModules, unpackShellFiles } from "../utils/node.js";
import { permissionNativeModules, unpackNativeModules, unpackShellFiles } from "../utils/node.js";
import { createShellConfigs } from "../utils/shell.js";
import { shellResourcesPath, nativeResourcesPath, loggingResourcesPath, initResourcesPath } from "../utils/constants.js";
import fs from "node:fs";
Expand All @@ -16,6 +16,7 @@ export const render = async () => {

await createShellConfigs();
await unpackNativeModules();
await permissionNativeModules();
await unpackShellFiles();
process.stdout.write(chalk.green("✓") + " successfully installed inshellisense \n");
};
9 changes: 9 additions & 0 deletions src/utils/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export const unpackNativeModules = async (): Promise<void> => {
);
};

export const permissionNativeModules = async (): Promise<void> => {
if (!sea.isSea()) return;

const spawnHelper = path.join(nativeResourcesPath, "spawn-helper");
if (fs.existsSync(spawnHelper)) {
await fsAsync.chmod(spawnHelper, 0o755);
}
};

export const unpackShellFiles = async (): Promise<void> => {
if (!sea.isSea()) {
const shellFolderPath = path.join(process.cwd(), "shell");
Expand Down