MCPcopy
hub / github.com/prisma/prisma / execaCommand

Function execaCommand

packages/internals/src/schemaEngineCommands.ts:168–207  ·  view source on GitHub ↗
({
  connectionString,
  cwd,
  schemaEnginePath,
  engineCommandName,
}: {
  connectionString: string
  cwd: string
  schemaEnginePath?: string
  engineCommandName: 'create-database' | 'drop-database' | 'can-connect-to-database'
})

Source from the content-addressed store, hash-verified

166}
167
168export async function execaCommand({
169 connectionString,
170 cwd,
171 schemaEnginePath,
172 engineCommandName,
173}: {
174 connectionString: string
175 cwd: string
176 schemaEnginePath?: string
177 engineCommandName: 'create-database' | 'drop-database' | 'can-connect-to-database'
178}) {
179 schemaEnginePath = schemaEnginePath || (await resolveBinary(BinaryType.SchemaEngineBinary))
180
181 try {
182 return await execa(
183 schemaEnginePath,
184 ['--datasource', JSON.stringify({ url: connectionString }), 'cli', engineCommandName],
185 {
186 cwd,
187 env: {
188 RUST_BACKTRACE: process.env.RUST_BACKTRACE ?? '1',
189 RUST_LOG: process.env.RUST_LOG ?? 'info',
190 },
191 },
192 )
193 } catch (_e) {
194 const e = _e as ExecaError
195
196 if (e.message) {
197 e.message = e.message.replace(connectionString, '<REDACTED>')
198 }
199 if (e.stdout) {
200 e.stdout = e.stdout.replace(connectionString, '<REDACTED>')
201 }
202 if (e.stderr) {
203 e.stderr = e.stderr.replace(connectionString, '<REDACTED>')
204 }
205 throw e
206 }
207}

Callers 11

canConnectToDatabaseFunction · 0.85
createDatabaseFunction · 0.85
dropDatabaseFunction · 0.85
executeSeedCommandFunction · 0.85
DbSeed.test.tsFile · 0.85
runFunction · 0.85
runFunction · 0.85
runFunction · 0.85
runResultFunction · 0.85
runFunction · 0.85

Calls 1

resolveBinaryFunction · 0.90

Tested by

no test coverage detected