type-git 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { G as GitErrorCategory, e as ExecOpts, f as RawResult, L as LfsMode, g as GitProgress, h as GitOpenOptions, R as RuntimeAdapters, i as ExecutionContext, j as GitError, E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle } from '../../adapters-DehG3CsV.cjs';
1
+ import { G as GitErrorCategory, e as ExecOpts, f as RawResult, L as LfsMode, g as GitProgress, h as GitOpenOptions, R as RuntimeAdapters, i as ExecutionContext, j as GitError, E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle } from '../../adapters-BFRtEriX.cjs';
2
2
 
3
3
  /**
4
4
  * stdout parsing utilities for Git output
@@ -1,4 +1,4 @@
1
- import { G as GitErrorCategory, e as ExecOpts, f as RawResult, L as LfsMode, g as GitProgress, h as GitOpenOptions, R as RuntimeAdapters, i as ExecutionContext, j as GitError, E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle } from '../../adapters-DehG3CsV.js';
1
+ import { G as GitErrorCategory, e as ExecOpts, f as RawResult, L as LfsMode, g as GitProgress, h as GitOpenOptions, R as RuntimeAdapters, i as ExecutionContext, j as GitError, E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle } from '../../adapters-BFRtEriX.js';
2
2
 
3
3
  /**
4
4
  * stdout parsing utilities for Git output
@@ -5894,6 +5894,13 @@ var NodeExecAdapter = class {
5894
5894
  wait: () => waitPromise,
5895
5895
  kill: (sig) => {
5896
5896
  child.kill(sig ?? "SIGTERM");
5897
+ },
5898
+ [Symbol.asyncDispose]: async () => {
5899
+ if (child.exitCode === null) {
5900
+ child.kill("SIGTERM");
5901
+ }
5902
+ await waitPromise.catch(() => {
5903
+ });
5897
5904
  }
5898
5905
  };
5899
5906
  }
@@ -5941,7 +5948,8 @@ function createTailPolling(options) {
5941
5948
  state.resolveNext = null;
5942
5949
  }
5943
5950
  };
5944
- startPollingLoop(adapter, state, signal, pollInterval, stop).catch(() => {
5951
+ const pollingPromise = startPollingLoop(adapter, state, signal, pollInterval, stop);
5952
+ pollingPromise.catch(() => {
5945
5953
  });
5946
5954
  const lines = {
5947
5955
  [Symbol.asyncIterator]() {
@@ -5963,7 +5971,15 @@ function createTailPolling(options) {
5963
5971
  };
5964
5972
  }
5965
5973
  };
5966
- return { lines, stop };
5974
+ return {
5975
+ lines,
5976
+ stop,
5977
+ [Symbol.asyncDispose]: async () => {
5978
+ stop();
5979
+ await pollingPromise.catch(() => {
5980
+ });
5981
+ }
5982
+ };
5967
5983
  }
5968
5984
  async function startPollingLoop(adapter, state, signal, pollInterval, stop) {
5969
5985
  let position = 0;
@@ -5987,6 +6003,9 @@ async function startPollingLoop(adapter, state, signal, pollInterval, stop) {
5987
6003
  }
5988
6004
  }
5989
6005
  }
6006
+ if (state.stopped || signal?.aborted) {
6007
+ break;
6008
+ }
5990
6009
  await adapter.sleep(pollInterval);
5991
6010
  }
5992
6011
  stop();
@@ -6075,16 +6094,26 @@ var NodeFsAdapter = class {
6075
6094
  sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms))
6076
6095
  };
6077
6096
  const polling = createTailPolling({ adapter, signal, pollInterval });
6078
- const originalStop = polling.stop;
6079
- const enhancedStop = () => {
6080
- originalStop();
6097
+ const closeFileHandle = async () => {
6081
6098
  if (state.file) {
6082
- state.file.close().catch(() => {
6099
+ await state.file.close().catch(() => {
6083
6100
  });
6084
6101
  state.file = null;
6085
6102
  }
6086
6103
  };
6087
- return { lines: polling.lines, stop: enhancedStop };
6104
+ const originalStop = polling.stop;
6105
+ const enhancedStop = () => {
6106
+ originalStop();
6107
+ void closeFileHandle();
6108
+ };
6109
+ return {
6110
+ lines: polling.lines,
6111
+ stop: enhancedStop,
6112
+ [Symbol.asyncDispose]: async () => {
6113
+ await polling[Symbol.asyncDispose]();
6114
+ await closeFileHandle();
6115
+ }
6116
+ };
6088
6117
  }
6089
6118
  };
6090
6119