Skip to content

Commit 8db2bc9

Browse files
authored
Fix the sandbox check to also work for docker/podman containers (#78)
* fix the sandbox check to also work for docker/podman containers * check for non-empty value of "container" env var
1 parent bb475cf commit 8db2bc9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import 'dart:io';
22

3-
/// Returns `true` if the app is running in a sandbox, eg. Flatpak or Snap.
3+
/// Returns `true` if the app is running in a sandbox, eg. Flatpak, Snap, Docker, Podman.
44
bool runningInSandbox() {
55
return Platform.environment.containsKey('FLATPAK_ID') ||
6-
Platform.environment.containsKey('SNAP');
6+
Platform.environment.containsKey('SNAP') ||
7+
(Platform.environment['container']?.isNotEmpty == true) ||
8+
FileSystemEntity.isFileSync('/.dockerenv');
79
}

0 commit comments

Comments
 (0)