mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-10 22:41:14 +00:00
Typos + promisify exec calls (#2243)
This commit is contained in:
parent
d15f813514
commit
e050043e58
4 changed files with 36 additions and 27 deletions
|
|
@ -23,11 +23,11 @@ suite("Roo Code Task", () => {
|
|||
|
||||
await waitUntilCompleted({ api, taskId })
|
||||
|
||||
const completion = messages.find(({ say, partial }) => say === "completion_result")
|
||||
|
||||
assert.ok(
|
||||
completion?.text?.includes("My name is Roo"),
|
||||
`Completion should include "My name is Roo" - ${completion?.text}`,
|
||||
!!messages.find(
|
||||
({ say, text }) => (say === "completion_result" || say === "text") && text?.includes("My name is Roo"),
|
||||
),
|
||||
`Completion should include "My name is Roo"`,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export function SettingsDiff({
|
|||
const isDefault = JSON.stringify(defaultValue) === JSON.stringify(customValue)
|
||||
|
||||
return isDefault ? null : (
|
||||
<SetttingDiff
|
||||
<SettingDiff
|
||||
key={key}
|
||||
name={key}
|
||||
defaultValue={JSON.stringify(defaultValue, null, 2)}
|
||||
|
|
@ -46,7 +46,7 @@ type SettingDiffProps = HTMLAttributes<HTMLDivElement> & {
|
|||
customValue?: string
|
||||
}
|
||||
|
||||
export function SetttingDiff({ name, defaultValue, customValue, ...props }: SettingDiffProps) {
|
||||
export function SettingDiff({ name, defaultValue, customValue, ...props }: SettingDiffProps) {
|
||||
return (
|
||||
<Fragment {...props}>
|
||||
<div className="overflow-hidden font-mono">{name}</div>
|
||||
|
|
|
|||
|
|
@ -3,32 +3,33 @@
|
|||
import psTree from "ps-tree"
|
||||
import { exec } from "child_process"
|
||||
|
||||
export const getProcessList = async (pid: number) => {
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
exec(`ps -p ${pid} -o pid=`, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
reject(stderr)
|
||||
const asyncExec = (command: string): Promise<{ stdout: string; stderr: string }> =>
|
||||
new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else {
|
||||
resolve({ stdout, stderr })
|
||||
}
|
||||
|
||||
resolve(stdout)
|
||||
})
|
||||
})
|
||||
|
||||
export const getProcessList = async (pid: number) => {
|
||||
try {
|
||||
await promise
|
||||
await asyncExec(`ps -p ${pid} -o pid=`)
|
||||
|
||||
return new Promise<number[]>((resolve, reject) => {
|
||||
psTree(pid, (err, children) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
}
|
||||
|
||||
resolve(children.map((p) => parseInt(p.PID)))
|
||||
})
|
||||
})
|
||||
} catch (_) {
|
||||
return null
|
||||
}
|
||||
|
||||
return new Promise<number[]>((resolve, reject) => {
|
||||
psTree(pid, (err, children) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
}
|
||||
|
||||
resolve(children.map((p) => parseInt(p.PID)))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const killProcessTree = async (pid: number) => {
|
||||
|
|
@ -39,8 +40,16 @@ export const killProcessTree = async (pid: number) => {
|
|||
}
|
||||
|
||||
if (descendants.length > 0) {
|
||||
await exec(`kill -9 ${descendants.join(" ")}`)
|
||||
try {
|
||||
await asyncExec(`kill -9 ${descendants.join(" ")}`)
|
||||
} catch (error) {
|
||||
console.error("Error killing descendant processes:", error)
|
||||
}
|
||||
}
|
||||
|
||||
await exec(`kill -9 ${pid}`)
|
||||
try {
|
||||
await asyncExec(`kill -9 ${pid}`)
|
||||
} catch (error) {
|
||||
console.error("Error killing main process:", error)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Update `src/schema.ts` as needed, and then run:
|
|||
pnpm db:generate
|
||||
```
|
||||
|
||||
Inspect the generated sql in the migration filed added to `drizzle/`.
|
||||
Inspect the sql in the migration file added to `drizzle/`.
|
||||
|
||||
If it looks okay, then run:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue