Runtime Error with Command Execution in Effect Typescript Library
import * as Command from '@effect/platform/Command';
import * as BunContext from '@effect/platform-bun/BunContext';
import * as Effect from 'effect/Effect';
import * as Layer from 'effect/Layer';
const command = Command.make('rg');
export class Finder extends Effect.Service<Finder>()('Finder', {
sync: () => {
return {
find: Effect.fnUntraced(function* (term: string, path: string) {
return yield* Command.string(
command.pipe(
Command.stdout('inherit'),
Command.feed(`--files-with-matches "${term}"`),
Command.feed(path),
),
);
}),
};
},
}) {}
const FinalLayer = Layer.mergeAll(Finder.Default, BunContext.layer);
const program = Effect.gen(function* () {
const finder = yield* Finder;
const result = yield* finder.find('@DataBuilder', 'src');
yield* Effect.log(result);
}).pipe(Effect.provide(FinalLayer));
Effect.runPromise(program);import * as Command from '@effect/platform/Command';
import * as BunContext from '@effect/platform-bun/BunContext';
import * as Effect from 'effect/Effect';
import * as Layer from 'effect/Layer';
const command = Command.make('rg');
export class Finder extends Effect.Service<Finder>()('Finder', {
sync: () => {
return {
find: Effect.fnUntraced(function* (term: string, path: string) {
return yield* Command.string(
command.pipe(
Command.stdout('inherit'),
Command.feed(`--files-with-matches "${term}"`),
Command.feed(path),
),
);
}),
};
},
}) {}
const FinalLayer = Layer.mergeAll(Finder.Default, BunContext.layer);
const program = Effect.gen(function* () {
const finder = yield* Finder;
const result = yield* finder.find('@DataBuilder', 'src');
yield* Effect.log(result);
}).pipe(Effect.provide(FinalLayer));
Effect.runPromise(program);this program fails with runtime error, am I doing something wrong or is it effect bug?
TypeError: null is not an object (evaluating 'readable.readable')TypeError: null is not an object (evaluating 'readable.readable')