Skip to content

Commit

Permalink
try try try again
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Aug 26, 2024
1 parent 18a5536 commit 43ea1ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Pty, getCloseOnExec, setCloseOnExec } from '../wrapper';
import { type Writable } from 'stream';
import { readdirSync, readlinkSync } from 'fs';
import { describe, test, expect } from 'vitest';
import { exec } from 'child_process';

const EOT = '\x04';
const procSelfFd = '/proc/self/fd/';
Expand Down Expand Up @@ -416,17 +417,20 @@ describe(

describe('cgroup opts', () => {
testSkipOnDarwin('basic cgroup', () => {
// create a new cgroup
exec("sudo cgcreate -g 'cpu:/test.slice'")

// cat current cgroup and check if it matches cgroupPath
const oldFds = getOpenFds();
let buffer = '';
const pty = new Pty({
command: '/bin/cat',
args: ['/proc/self/cgroup'],
cgroupPath: '/sys/fs/cgroup/user.slice/test.slice',
cgroupPath: '/sys/fs/cgroup/cpu/test.slice',
onExit: (err, exitCode) => {
expect(err).toBeNull();
expect(exitCode).toBe(0);
expect(buffer.trim()).toBe('1');
expect(buffer.trim()).toBe(pty.pid.toString());
expect(getOpenFds()).toStrictEqual(oldFds);
},
});
Expand Down

0 comments on commit 43ea1ed

Please sign in to comment.