Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: tests/standalone/io/file_lock_script.dart

Issue 833623004: Add support for file locking (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows test Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // Script used by the file_lock_test.dart test.
6
7 import "dart:io";
8
9 main(List<String> args) {
10 File file = new File(args[0]);
11 int start = null;
12 int end = null;
13 var mode = FileLock.EXCLUSIVE;
14 if (args[1] == 'SHARED') {
15 mode = FileLock.SHARED;
16 }
17 if (args[2] != 'null') {
18 start = int.parse(args[2]);
19 }
20 if (args[3] != 'null') {
21 end = int.parse(args[3]);
22 }
23 var raf = file.openSync(mode: WRITE);
24 try {
25 raf.lockSync(mode, start, end);
26 print('LOCK SUCCEEDED');
27 } catch (e) {
28 print('LOCK FAILED');
29 } finally {
30 raf.closeSync();
31 }
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698