Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function stopTunnelsAsync(projectRoot: string) {
await UserManager.ensureLoggedInAsync();
_assertValidProjectRoot(projectRoot); // This will kill all ngrok tunnels in the process. // We'll need to change this if we ever support more than one project // open at a time in XDE.
let packagerInfo = await ProjectSettings.readPackagerInfoAsync(projectRoot);
let ngrokProcess = ngrok.process();
let ngrokProcessPid = ngrokProcess ? ngrokProcess.pid : null;
ngrok.removeAllListeners('statuschange');
if (packagerInfo.ngrokPid && packagerInfo.ngrokPid !== ngrokProcessPid) {
// Ngrok is running in some other process. Kill at the os level.
try {
process.kill(packagerInfo.ngrokPid);
} catch (e) {
ProjectUtils.logDebug(
projectRoot,
'expo',
`Couldn't kill ngrok with PID ${packagerInfo.ngrokPid}`
);
}
} else {
// Ngrok is running from the current process. Kill using ngrok api.
await ngrokKillAsync();
}
await ProjectSettings.setPackagerInfoAsync(projectRoot, {
export async function stopTunnelsAsync(projectRoot: string) {
_assertValidProjectRoot(projectRoot);
// This will kill all ngrok tunnels in the process.
// We'll need to change this if we ever support more than one project
// open at a time in XDE.
let packagerInfo = await ProjectSettings.readPackagerInfoAsync(projectRoot);
let ngrokProcess = ngrok.process();
let ngrokProcessPid = ngrokProcess ? ngrokProcess.pid : null;
ngrok.removeAllListeners('statuschange');
if (packagerInfo.ngrokPid && packagerInfo.ngrokPid !== ngrokProcessPid) {
// Ngrok is running in some other process. Kill at the os level.
try {
process.kill(packagerInfo.ngrokPid);
} catch (e) {
ProjectUtils.logDebug(
projectRoot,
'expo',
`Couldn't kill ngrok with PID ${packagerInfo.ngrokPid}`
);
}
} else {
// Ngrok is running from the current process. Kill using ngrok api.
await ngrokKillAsync();
}
await ProjectSettings.setPackagerInfoAsync(projectRoot, {
export async function stopTunnelsAsync(projectRoot: string): Promise {
_assertValidProjectRoot(projectRoot);
// This will kill all ngrok tunnels in the process.
// We'll need to change this if we ever support more than one project
// open at a time in XDE.
let packagerInfo = await ProjectSettings.readPackagerInfoAsync(projectRoot);
let ngrokProcess = ngrok.process();
let ngrokProcessPid = ngrokProcess ? ngrokProcess.pid : null;
ngrok.removeAllListeners('statuschange');
if (packagerInfo.ngrokPid && packagerInfo.ngrokPid !== ngrokProcessPid) {
// Ngrok is running in some other process. Kill at the os level.
try {
process.kill(packagerInfo.ngrokPid);
} catch (e) {
ProjectUtils.logDebug(
projectRoot,
'expo',
`Couldn't kill ngrok with PID ${packagerInfo.ngrokPid}`
);
}
} else {
// Ngrok is running from the current process. Kill using ngrok api.
await ngrokKillAsync();
}
await ProjectSettings.setPackagerInfoAsync(projectRoot, {